package cn.uniqueinfo.dp.util;

import org.apache.shiro.SecurityUtils;

/**
 * @author:朱元勋
 * @mail:395910063@qq.com
 * @date:2019-01-25 16:18:07
 * @description:
 */
public class PermissionUtil {
    /**
     * @author:朱元勋
     * @date:2019/1/9 13:56
     * @description: 权限验证
     * @param permission 权限
     * @return:void
     */
    public static void checkPermission(String modelName, String permission) {
        if (modelName != null && modelName != "") {
            permission = modelName + ":" + permission;
        }
        // 断言式权限验证 断言成功，不返回任何值，程序继续执行；断言失败时，将抛出异常信息
        SecurityUtils.getSubject().checkPermission(permission);
    }
}
